import QtQuick
import QtQuick.Controls

Button {
    id: control
    property string tipName: ""
    property alias cursorShape: _mouseArea.cursorShape
    property alias iconName: _iconLb.iconName
    property alias iconSize: _iconLb.iconSize
    property color iconColor: palette.buttonText
    property color iconHoveredColor: Qt.alpha(palette.highlight, 0.8)
    readonly property alias currentIconColor: _iconLb.color

    contentItem: FontIcon {
        id: _iconLb
        color: control.enabled ? (control.hovered ? control.iconHoveredColor : control.iconColor) : Qt.darker(control.iconColor, 2)
    }
    background: MouseArea {
        id: _mouseArea
        anchors.fill: parent
        hoverEnabled: true
        acceptedButtons: Qt.NoButton
        cursorShape: Qt.PointingHandCursor
        MToolTip {
            font.pixelSize: 12
            text: control.tipName
            visible: control.hovered && control.tipName !== ""
            x: _mouseArea.mouseX + 10
            y: _mouseArea.mouseY + 10
        }
    }
}
